Data compression method and recording medium with data compression program recorded therein

ABSTRACT

A data compression method includes: a quantization trial step in which input data are quantized using an initial quantization table set in advance; a coding trial step in which a code volume achieved when data that have undergone quantization in the quantization trial step are coded is determined; a relationship ascertaining step in which a scale factor in the initial quantization table and the code volume are substituted in “a relational expression representing a relationship between a code volume and a scale factor” containing two undetermined parameters “a” and “b” and the undetermined parameters in the relational expression are ascertained based upon “the relational expression after substitution” and “a statistical relationship between the undetermined parameters “a” and “b” determined through a previous quantization operation;” a scale factor determining step in which a target scale factor corresponding to a target code volume is determined by using the relational expression having the undetermined parameters ascertained in the relationship ascertaining step substituted therein; a quantization step in which the input data are quantized by using a quantization table corresponding to the target scale factor determined in the scale factor determining step; and a coding step in which data that have undergone quantization in the quantization step are coded.

[0001] The disclosure of the following priority application is hereinincorporated by reference:

[0002] Japanese Patent Application No. 10-284531 filed Oct. 6, 1998

[0003] The disclosure of U.S. Pat. No. 5,594,554 is herein incorporatedby reference.

BACKGROUND OF THE INVENTION

[0004] 1. Field of the Invention

[0005] The present invention relates to a data compression method and arecording medium with a data compression program for executing the datacompression method recorded therein. More specifically, the presentinvention relates to technology through which conditions forquantization that are required to obtain a desired code volume aredetermined with a high degree of accuracy through a single trial.

[0006] 2. Description of the Related Art

[0007] Processing such as image compression (e.g., JPEG compression) isperformed on image data as a standard procedure in an electronic cameraor a computer to record image data in a recording medium with a highdegree of efficiency. Such image compression processing may be executedthrough the procedure described in (1)˜(4) below, for instance.

[0008] (1) The image data are divided into pixel blocks each constitutedof approximately 8×8 pixels. Orthogonal transformation such as DCT(discrete cosine transformation) is performed on these pixel blocks toconvert the image data to spatial frequency components.

[0009] (2) A standard quantization table that defines quantizationincrements corresponding to the individual spatial frequency componentsconstituted of 8×8 pixels is prepared. The standard quantization tableis multiplied by a scale factor SF to obtain a quantization table thatis to be used.

[0010] (3) Using the quantization table obtained as described above, thedata that have undergone DCT are quantized.

[0011] (4) The quantized data are coded through variable-length coding,run-length coding or the like.

[0012] However, since the volume of information greatly varies amongdifferent sets of image data, it is extremely difficult to uniformlypredict the code volume after compression. For this reason, it isnecessary to follow the procedure in (1)˜(4) described above many timeswhile varying the value of the scale factor SF in order to perform thecompression which results in a desired code volume (hereafter referredto as the “target code volume”). As a means for reducing the number ofsuch trials, U.S. Pat. No. 5,594,554, the disclosure of which is hereinincorporated by reference, discloses a method whereby a correct scalefactor SF is determined based upon the minimum of two trialcompressions.

[0013]FIG. 18 is a flowchart illustrating this method in the prior art.The following is an explanation of the method in the prior art, givenalong the flow of the steps in FIG. 18. First, in the method in theprior art, a first trial compression is performed on input image data. Ascale factor SF1 used at this time and a code volume ACVdata1 after thecompression are stored in memory (FIG. 18 S91).

[0014] Next, a second trial compression is performed on the input imagedata. A scale factor SF2 used at this time and a code volume ACVdata2after the compression are stored in memory (FIG. 18 S92). The resultsthus obtained are incorporated in a relational expression representingthe relationship between the scale factor SF and the code volume ACVdatato obtain;

[0015] First Relational Expression:

log(ACVdata1)=a*log(SF1)+b  (1)

[0016] and

[0017] Second Relational Expression:

log(ACVdata2)=a*log(SF2)+b  (2).

[0018] By solving expression 1 and expression 2 above, the twoundetermined parameters “a” and “b” in the relational expressions areascertained (FIG. 18 S93). As a result, a relational expression thatexpresses in approximation the relationship between the scale factor SFand the code volume ACVdata is obtained for the input image data;

[0019] Relational Expression:

log(ACVdata)=a*log(SF)+b  (3).

[0020] By solving this relational expression 3 with a target code volumeTCV substituted in it, an appropriate target scale factor NSF forachieving the target code volume TCV is calculated (FIG. 18 S94). Usingthis target scale factor NSF, the input image data are compressed again(FIG. 18 S95).

[0021] In the method in the prior art described above, at least twotrial compressions must be executed to ascertain the two undeterminedparameters “a” and “b”. However, a further reduction in the number oftrials is urgently required to support faster image compression and thelike.

SUMMARY OF THE INVENTION

[0022] An object of the present invention is to provide a datacompression method that makes it possible to obtain a target scalefactor NSF through a single trial and a recording medium having a datacompression program that makes it possible to implement the datacompression method on a computer recorded therein.

[0023]FIG. 1 is a flowchart that illustrates the present invention. Thefollowing is an explanation of the present invention given in referenceto FIG. 1.

[0024] In order to achieve the object described above, the datacompression method according to the present invention comprises aquantization trial step (FIG. 1 S1, FIG. 4 S36, FIG. 9 S48, FIG. 12 S36,FIG. 14 S76) in which input data are quantized using an initialquantization table that is set in advance, a coding trial step (FIG. 1S2, FIG. 4 S36, FIG. 9 S48, FIG. 12 S36, FIG. 14 S77) in which a codevolume achieved when the data that have undergone quantization in thequantization trial step are coded is determined, a relationshipascertaining step (FIG. 1 S3 and S4, FIG. 4 S37, FIG. 9 S52, FIG. 12S37, FIG. 14 S78 and S79) in which the scale factor in the initialquantization table and the code volume are substituted in “therelational expression representing the relationship between the codevolume and the scale factor” that includes two undetermined parameters“a” and “b” to ascertain the undetermined parameters in the relationalexpression based upon “the relational expression after the substitution”and “the statistical relationship between the undetermined parameters“a” and “b” obtained through a previous quantization operation,” a scalefactor determining step (FIG. 1 S5, FIG. 4 S38, FIG. 9 S53, FIG. 12 S38,FIG. 14 S80) in which a target scale factor that corresponds to thetarget code volume is determined by using the relational expressionhaving the undetermined parameter ascertained in the relationshipascertaining step substituted therein, a quantization step (FIG. 1 S6and S7, FIG. 4 S39, FIG. 9 S54, FIG. 12 S39, FIG. 14 S81 and S82) inwhich the input data are quantized using a quantization table thatcorresponds to the target scale factor determined in the scale factordetermining step and a coding step (FIG. 1 S8, FIG. 4 S39, FIG. 9 S54,FIG. 12 S39, FIG. 14 S83) in which the data that have been quantized inthe quantization step are coded.

[0025] The inventors of the present invention have discovered that, asdemonstrated in the embodiments which are to be detailed later, there isa statistical relationship achieving a high degree of reproducibilitybetween the two undetermined parameters “a” and “b”. Thus, in therelationship ascertaining step in the present invention, thisstatistical relationship obtained through a previous quantizationoperation is utilized to ascertain the undetermined parameters. Thissubstantially reduces the number of undetermined parameters in therelational expression explained above from 2 to 1.

[0026] Thus, it becomes possible to ascertain all the undeterminedparameters in the relational expression by obtaining trial data of theinput data (the scale factor, the code volume) at least once.Consequently, through the data compression method according to thepresent invention, the number of trials can be reduced compared to thenumber of trials required in the method in the prior art (at least 2),so that the quantity of calculation required in the data compressionmethod and the length of time required for implementing the datacompression method are reduced with a high degree of reliability.

[0027] In the data compression method described above, it is preferablethat the relationship ascertaining step includes steps (1) and (2)described below.

[0028] (1) An area selection step (FIG. 9 S49) in which, with coordinatespace whose axes are the scale factor and the code volume divided into aplurality of areas and the statistical relationship between the twoundetermined parameters “a” and “b” ascertained in advance for each ofthose areas, one of the plurality of areas is selected based upon thescale factor in the initial quantization table and the code volumedetermined in the coding trial step and

[0029] (2) An individual area relationship ascertaining step (FIG. 9S50˜S52) in which the undetermined parameters in the relationalexpression are ascertained by substituting the scale factor in theinitial quantization table and the code volume determined in the codingtrial step in the relational expression, based upon “the relationalexpression after the substitution” and “the statistical relationship inthe area selected in the area selection step.”

[0030] In the data compression method described above, the coordinatespace whose axes are the scale factor and the code volume is dividedinto a plurality of areas and the parameters are ascertained for theindividual areas. By determining the statistical relationship for eacharea in this manner, the accuracy and the reproducibility of thestatistical relationship in the individual areas can be furtherimproved. Thus, it is possible to ascertain the parameters with an evenhigher degree of accuracy.

[0031] In addition, in the area selection step, an area is selectedbased upon the scale factor and the code volume obtained during thetrial stage. Thus, “the area selection” and “the parameter ascertaining”can be executed at once using the results of a single trial to minimizethe degree of increase in the calculation quantity and the requiredlength of processing time that the processing of the individual areasentails.

[0032] Furthermore, during the scale factor determining step, it ispreferable that the target code volume be varied in correspondence tothe code volume determined in the coding trial step (FIG. 12 S60 andS61). By adopting such a data compression method, it is possible toavoid any degradation of information by increasing the target codevolume when, for instance, the code volume obtained during the trialstage is relatively large and, consequently, high compression isdifficult to achieve.

[0033] If, on the other hand, it is assumed that high compression of theinput data is possible due to a small code volume obtained during thetrial stage, the code volume can be reduced to an appropriate degree bylowering the target code volume. By varying the target code volume inconformance to the code volume obtained during the trial stage, itbecomes possible to execute quantization that corresponds to the qualityand the content of the input data in a flexible manner. In addition,such a change of the target code volume is executed based upon the codevolume obtained during the trial stage. Consequently, it is possible toexecute both “the change of target code volume” and “parameterascertaining” at once using the results of a single trial so that thedegree to which the calculation quantity and the required length ofprocessing time increase due to the change of the target code volume canbe minimized.

[0034] Another data compression method comprises a quantization trialstep (FIG. 1 S1, FIG. 4 S36, FIG. 9 S48, FIG. 12 S36) in which inputdata are quantized using an initial quantization table set in advance, acoding trial step in which a code volume ACVdata achieved when the datathat have been quantized in the quantization trial step are coded isdetermined, a relationship ascertaining step (FIG. 1 S3 and S4, FIG. 4S37, FIG. 9 S52, FIG. 12 S37) in which an unknown parameter “a” isascertained by calculating

a={log(ACVdata)−C2}/{log(ISF)+C1},

[0035] using the code volume ACVdata, the scale factor ISF in theinitial quantization table and values C1 and C2 which are statisticallydetermined through a previous quantization operation, a scale factordetermining step (FIG. 1 S5, FIG. 4 S38, FIG. 9 S53, FIG. 12 S38) inwhich a target scale factor NSF is determined by calculating

NSF=(ACVdata/TCV)^((−1/a))*ISF,

[0036] using the code volume ACVdata, the scale factor ISF in theinitial quantization table and a target code volume TCV, a quantizationstep (FIG. 1 S6 and S7, FIG. 4 S39, FIG. 9 S54, FIG. 12 S39) in whichthe input data are quantized using a quantization table that correspondsto the target scale factor NSF determined in the scale factordetermining step and a coding step (FIG. 1 S8, FIG. 4 S39, FIG. 9 S54,FIG. 12 S39) in which the data quantized in the quantization step arecoded.

[0037] The data compression method described above is characterized inthat the statistical relationship between the undetermined parameters“a” and “b” is expressed through a linear expression, b=C1*a+C2. Thus,the statistical relationship can be stored in a simple manner using thetwo coefficients C1 and C2. In addition, since a simple linearexpression is used when ascertaining the parameters, too, thecalculation quantity and the required length of processing time can bereduced with ease.

[0038] Another data compression method comprises a quantization trialstep (FIG. 16 S101) in which input data are quantized using an initialquantization table, a coding trial step (FIG. 16 S102) in which the codevolume achieved when the data that have been quantized in thequantization trial step are coded is determined, a scale factordetermining step (FIG. 16 S103 and S104) in which a target scale factorthat corresponds to the code volume determined in the coding trial stepis determined based upon the correlation between “the code volumeresulting from quantization and coding of test data performed by usingthe initial quantization table” and “the target scale factor to be usedto quantize the test data to achieve a target code volume” that isascertained and stored in advance, a quantization step (FIG. 16 S105) inwhich the input data are quantized using a quantization tablecorresponding to the target scale factor determined in the scale factordetermining step and a coding step (FIG. 16 S106) in which the dataquantized in the quantization step are coded.

[0039] As mentioned earlier, the inventors of the present invention havelearned that there is a statistical relationship that achieves a highdegree of reproducibility between the two undetermined parameters “a”and “b”. This means that “the code volume obtained during the trialstage” and “the target scale factor” correspond with each other on aone-to-one basis (in a univocal manner) with a high degree ofprobability. Thus, in the data compression method described above, theone-to-one correlation mentioned above is determined through testing andis stored as a preparation. Then, based upon this correlation, thecorresponding target scale factor is directly or through interpolationobtained using the code volume obtained during the trial stage.Consequently, the target scale factor can be determined quickly withouthaving to perform any arithmetic operation to calculate the undeterminedparameters.

[0040] In the recording medium according to the present invention, adata compression program for executing the various data compressionmethods described above on a computer or an information processingapparatus is recorded. In addition, the data signal embodied in acarrier wave according to the present invention comprises the datacompression program for executing the various data compression methodsdescribed above on a computer or an information processing apparatus.Furthermore, a data compression processing apparatus according to thepresent invention executes the various data compression methodsexplained above on input data. The electronic camera according to thepresent invention executes the various data compression methods on imagedata obtained through image capturing.

BRIEF DESCRIPTION OF THE DRAWINGS

[0041]FIG. 1 is a flowchart illustrating the present invention;

[0042]FIG. 2 illustrates a system configuration employed to implementthe quantization method;

[0043]FIG. 3 illustrates the preparation procedure for the quantizationmethod;

[0044]FIG. 4 is a flowchart that schematically illustrates the imagecompression program (which includes the quantization program);

[0045]FIG. 5 presents examples of data (scale factor SF, code volumeACVdata);

[0046]FIG. 6 presents plotted test data of the undetermined parameters“a” and “b”;

[0047]FIG. 7 is a block diagram of the electronic camera 31;

[0048]FIG. 8 illustrates the preparation procedure for the quantizationmethod;

[0049]FIG. 9 is a flowchart schematically illustrating the imagecompression program (which includes the quantization program);

[0050]FIG. 10 presents examples of data (scale factor SF, code volumeACVdata);

[0051]FIG. 11 presents test data with respect to the parameters “a” and“b” obtained separately from areas A and B and the results of regressionanalysis;

[0052]FIG. 12 is a flowchart schematically illustrating the imagecompression program (which includes the quantization program);

[0053]FIG. 13 illustrates the preparation procedure;

[0054]FIG. 14 is a flowchart schematically illustrating the imagecompression program (which includes the quantization program);

[0055]FIG. 15 presents plotted test data with respect to theundetermined parameters “a” and “b”;

[0056]FIG. 16 is a flowchart schematically illustrating the imagecompression program (which includes the quantization program);

[0057]FIG. 17 illustrates how a data compression program may be providedthrough a communication line; and

[0058]FIG. 18 illustrates a method in the prior art.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0059] The following is an explanation of the embodiments of the presentinvention, given in reference to the drawings.

[0060] (First Embodiment)

[0061]FIG. 2 illustrates a system configuration which may be adopted toimplement the quantization or data compression method in the firstembodiment. In FIG. 2, a computer 11 is internally provided with an MPU(microprocessor) 12. An input device 13 constituted of a keyboard, amouse and the like, a hard disk 16, a memory 17, an image processingboard 18, a CD ROM drive device 20 and an input/output port 22 areconnected to the MPU 12. A monitor 19 is connected to an image outputterminal of the image processing board 18. In addition, an externalapparatus 23 such as an electronic camera is connected to theinput/output port 22.

[0062] A CD ROM 21, in which an image compression program that includesa quantization program and an installation program for installing theimage compression program are recorded is inserted in the CD ROM drivedevice 20. The installation program in the CD ROM 21 enables the MPU 12to arrange the individual programs in the CD ROM 21 so that they can bestored in the hard disk 16 in an executable state.

[0063] (Explanation of the Preparation)

[0064]FIG. 3 is a flowchart illustrating the preparation procedure forthe quantization method. Such a preparation is performed during, forinstance, the development of the quantization program under normalcircumstances. It is to be noted that, alternatively, the user of thecomputer 11 may execute the preparation by selecting specific imagesthat are used frequently so that the values for the coefficients C1 andC2 (to be detailed later) in the program can be changed.

[0065] First, in reference to FIG. 3, the procedure of this preparationis explained (in this context, the executor of the preparation isassumed to be the developer of the program to simplify the explanation).The developer prepares standard images (hereafter referred to as “testimages”) of as many types as possible within a range representative ofthe images to be processed. The developer executes DCT transformation onthese test images (FIG. 3 S31).

[0066] Next, the developer obtains a number of sets of data (scalefactor SF, code volume ACVdata) by repeating quantization and codingwhile gradually changing the value of the scale factor SF on theindividual test images having undergone the DCT (FIG. 3 S32). In FIG. 5,examples of data (scale factor SF, code volume ACVdata) thus obtainedare plotted in correspondence to the individual test images.

[0067] Next, the developer performs regression analysis on the data incorrespondence to the individual test images and determines parameters“a” and “b” that satisfy;

[0068] Relational Expression:

log(ACVdata)=a*log(SF)+b  (4) (FIG. 3 S33).

[0069] In FIG. 6, specific test data with respect to the parameters “a”and “b” obtained through this process are plotted. It is to be notedthat a great number of test images that may be specifically classifiedinto (1)˜(4) below are used to obtain such test data.

[0070] (1) Images of test charts such as an ITE super-fine resolutionchart, an ITE super-fine gray scale chart, super-fine standard image(food), a super-fine circular zone plate, a skin-color chart, a marina,a sweater and a valise, the Eiffel Tower, a hat shop, lovers in thesnow, a bulletin board, a tulip garden and chroma keys, captured by anelectronic camera.

[0071] (2) Captured images of various outdoor scenes in fair weatherwith a wide range of brightness levels (including flat areas such as skyand clouds, detailed areas such as trees and flower beds and the like)and people.

[0072] (3) Captured images of night scenes with reduced color andbrightness differences.

[0073] (4) Captured images of people taken indoors where brightnessdifferences are small.

[0074] As illustrated in FIG. 6, the test data with respect to theparameters “a” and “b” are not distributed randomly but are distributedwith a statistical relationship achieving a high degree ofreproducibility. Thus, the developer determines coefficients C1 and C2that satisfy the statistical relationship between “a” and “b”;

b=C1*a+C2  (5)

[0075] by performing a regression analysis on the test data with respectto “a” and “b” presented in FIG. 6 (FIG. 3 S34). The developer thenstores the coefficients C1 and C2 thus determined in the quantizationprogram.

[0076] (Explanation of the Quantization Method)

[0077] Following is a detailed explanation of the quantization method.

[0078]FIG. 4 is a flowchart that schematically illustrates the imagecompression program (which includes the quantization program) executedby the MPU 12. First, the MPU 12 selects one initial scale factor ISF incorrespondence to the value of the target compression rate (FIG. 4 S35).

[0079] The MPU 12 obtains an initial quantization table to be used for atrial compression by multiplying the standard quantization table by theinitial scale factor ISF thus selected. Using this initial quantizationtable, the MPU 12 performs a trial compression on an input image (FIG. 4S36).

[0080] Next, the MPU 12 calculates;

a={log(ACVdata)−C2}/{log(ISF)+C1}  (6),

[0081] using the code volume ACVdata after the trial compression and theinitial scale factor ISF to ascertain the undetermined parameter “a”(FIG. 4 S37).

[0082] It is to be noted that the expression 6 is an expression that isobtained based upon the relational expression 4 in which initial scalefactor ISF and code volume ACVdata are substituted and the statisticalrelationship expression 5 between “a” and “b” determined through thepreparation. The code volume ACVdata is obtained by coding data that hasbeen quantized by using the initial scale factor. However, it may not beneeded that the coded data file are actually generated. Any method isacceptable to count the code volume ACVdata. Also, the code volumeACVdata may be obtained by an approximate calculation with an expressionobtained through an experiment or the like.

[0083] Next, the MPU 12 calculates;

NSF=(ACVdata/TCV)^((−1/a))*ISF  (7),

[0084] using the target code volume TCV (=input data code volume×targetcompression rate) to determine an appropriate target scale factor NSFfor achieving the target code volume TCV (FIG. 4 S38).

[0085] The expression 7 is obtained by substituting “target scale factorNSF and target code volume TCV” in the relational expression 4 havingthe undetermined parameter “a” ascertained and transforming therelational expression. It is to be noted that during the process oftransforming the expression, the undetermined parameter “b” iseliminated by using the relational expression 4 having “initial scalefactor ISF and code volume ACVdata” substituted therein to simplify theexpression.

[0086] Next, the MPU 12 performs image compression on the input imageagain, using the target scale factor NSF (FIG. 4 S39). At this point,the MPU 12 makes a decision as to whether or not the code volume afterthe image compression falls within an allowable range of the target codevolume TCV (FIG. 4 S40). If it falls outside the allowable range by anychance (FIG. 4 S40 NO), the MPU 12 returns to the operation in step S38to repeat the image compression with an updated target scale factor NSF.

[0087] If it falls within the allowable range (FIG. 4 S40 YES), the MPU12 decides that the desired image compression (quantization) has beenachieved and ends the operation.

[0088] (Advantages of the First Embodiment)

[0089] As explained above, the number of undetermined parameters in therelational expression is reduced to substantially 1 by using thestatistical relationship between the undetermined parameters “a” and “b”in the first embodiment. Consequently, it is possible to ascertain allthe undetermined parameters in the relational expression based upon theresults of a minimum of one trial compression. Thus, it is not necessaryto execute at least two trial compression operations as in the method inthe prior art, so that the calculation quantity and the required lengthof processing time can be reduced with a high degree of reliability.

[0090] In addition, in the first embodiment in particular, thestatistical relationship between the undetermined parameters “a” and “b”is stored in memory as the values of the coefficients C1 and C2. As aresult, it is not necessary to store a complex functional expression ora complex data table to store the statistical relationship. Furthermore,since a simple linear expression is used to ascertain the parameters,too, the calculation quantity and the required length of processing timecan be reduced.

[0091] (Second Embodiment)

[0092]FIG. 7 is a block diagram of an electronic camera employed toexecute the quantization method (or data compression method) in thesecond embodiment.

[0093] In FIG. 7, the electronic camera 31 is provided with animage-capturing unit 32 constituted of a photographing optical system,an image-capturing element and the like. An image signal obtainedthrough image capturing at the image-capturing unit 32 is sent to an MPU(microprocessor) 33 after undergoing color signal processing, A/Dconversion and the like in the known art. An image compression unit 35that exclusively engages in JPEG compression, an image memory 34 thattemporarily stores image data, a memory card 36 that stores compressedimage data and the like are connected to the MPU 33.

[0094] (Explanation of the Preparation)

[0095]FIG. 8 illustrates the procedure of the preparation performed forthe quantization method. Such a preparation is implemented whiledesigning the electronic camera 31 under normal circumstances. It is tobe noted that the electronic camera 31 may execute the preparationprocedure on a captured image during intervals between image capturingoperations to automatically update the coefficients C1 and C2 (to bedetailed later). By performing such update processing, correctcoefficients C1 and C2 that are in conformance with the photographingtendency of the camera user can be obtained.

[0096] First, in reference to FIG. 8, the procedure of this preparationis explained. In this context, the executor of the preparation isassumed to be the designer of the electronic camera 31 to simplify theexplanation.

[0097] The designer prepares test images of as many types as possiblewithin a range representative of the images to be processed. Thedesigner executes DCT on these test images.

[0098] Next, the designer obtains a number of sets of data (scale factorSF, code volume ACVdata) by repeating quantization and coding whilegradually changing the value of the scale factor SF on the individualtest images having undergone DCT (FIG. 8 S41).

[0099]FIG. 10 presents examples of data (scale factor SF, code volumeACVdata) thus obtained. The designer divides a coordinate space (scalefactor SF, code volume ACVdata) into a plurality of areas A and B asillustrated in FIG. 10, based upon the data distribution curves. Next,the designer performs regression analysis on the data corresponding tothe area A to determine the parameters “a” and “b” that satisfyrelational expression;

log(ACVdata)=a*log(SF)+b  (8)

[0100] for the individual test images (FIG. 8 S42).

[0101] Then, the designer performs regression analysis on the parameters“a” and “b” determined for the area A to ascertain coefficients C1 andC2 that satisfy statistical relationship between “a” and “b”:

b=C1*a+C2  (9) (FIG. 8 S43).

[0102] The designer implements similar processing for the area B as well(FIG. 8 S34 and S45) to determine the coefficients C1 and C2.

[0103]FIG. 11 presents test data with respect to parameters “a” and “b”separately obtained for the areas A and B and the results of theregression analysis. The designer stores the coefficients C1 and C2corresponding to the individual areas in a read-only-memory inside theMPU 33.

[0104] (Explanation of the Quantization Method)

[0105] A detailed explanation of the specific quantization method isgiven below. FIG. 9 is a flowchart that schematically illustrates theimage compression program, which includes the quantization program,stored in the MPU 33. First, the MPU 33 selects one initial scale factorISF in correspondence to the value of the target compression rate (FIG.9 S47).

[0106] The MPU 33 obtains an initial quantization table to be used for atrial compression by multiplying the standard quantization table by theinitial scale factor ISF thus selected. Using this initial quantizationtable, the MPU 33 performs a trial compression on an input image (FIG. 9S48). Then, the MPU 33 selects a correct area for quantizationprocessing from either the area A or B based upon the results (initialscale factor ISF, code volume ACVdata) of the trial compression (FIG. 9S49).

[0107] In this example, the MPU 33 uses the coefficients C1 and C2 forthe area A if conditions “initial scale factor ISF≦0.1 and code volumeACVdata<target code volume TCV” are satisfied (FIG. 9 S49 YES) (FIG. 9S50). Otherwise (FIG. 9 S49 NO) the coefficients C1 and C2 for the areaB are used (FIG. 9 S51).

[0108] Next, the MPU 33 calculates;

a={log(ACVdata)−C2}/{log(ISF)+C1}  (10),

[0109] using the code volume ACVdata after the trial compression and theinitial scale factor ISF to ascertain the undetermined parameter “a”(FIG. 9 S52). It is to be noted that the coefficients C1 and C2 in theexpression 10 above are those selected through the area selectiondescribed above.

[0110] Next, the MPU 33 calculates;

NSF=(ACVdata/TCV)^((−1/a))*ISF  (11),

[0111] using the target code volume TCV to determine an appropriatetarget scale factor NSF for achieving the target code volume TCV (FIG. 9S53). Next, the MPU 33 performs image compression on the input imageagain, using the target scale factor NSF (FIG. 9 S54).

[0112] At this point, the MPU 33 makes a decision as to whether or notthe code volume after the image compression falls within an allowablerange of the target code volume TCV (FIG. 9 S55). If it falls outsidethe allowable range by any chance (FIG. 9 S55 NO), the MPU 33 returns tothe operation in step S53 to repeat the image compression with anupdated target scale factor NSF.

[0113] If, on the other hand, it falls within the allowable range (FIG.9 S55 YES), the MPU 33 decides that the desired image compression(quantization) has been achieved and ends the operation.

[0114] (Advantages of the Second Embodiment)

[0115] As explained above, advantages similar to those achieved in thefirst embodiment are achieved in the second embodiment. There is also anadded advantage unique to the second embodiment in that since theprocessing is performed for the individual areas, the accuracy and thereproducibility of the statistical relationship for each area arefurther improved so that the parameters “a” and “b” can be ascertainedwith an even higher degree of accuracy.

[0116] In addition, area selection is made using the results of thetrial compression in the second embodiment. As a result, it is possibleto execute both “the selection of the area to be used” and “theparameter ascertaining” at once through a single trial compression sothat the calculation quantity and the required length of processing timecan be minimized.

[0117] (Third Embodiment)

[0118]FIG. 12 is a flowchart that schematically illustrates the imagecompression program which includes the quantization program executed inthe third embodiment. If it is to be noted that since the systemconfiguration and the main operation of the third embodiment are almostidentical to those in the first embodiment (see FIGS. 2, 3 and 4), theirexplanation is omitted.

[0119] The third embodiment is characterized in that the target codevolume TCV is updated through threshold value decision-making performedon the code volume ACVdata resulting from a trial compression asillustrated in FIG. 12 (FIG. 12 S60 and S61). Such an operationperformed in the third embodiment makes it possible to change the targetcode volume in a flexible manner by making a rough judgment in regard tothe contents of an input image (whether the image is a line drawing or anatural picture, whether the gradation is complicated or flat, whetherthe number of colors is great or small, and the like) based upon thecode volume after the trial compression.

[0120] Concretely, when the code volume ACVdata resulting from a trialcompression is less than a predetermined threshold value (FIG. 12 S60YES), the target code volume TCV is reduced (FIG. 12 S61). When the codevolume ACVdata resulting from the trial compression is less than thethreshold value, a difference between the scale factor at the trialcompression and the scale factor estimated to obtain the target codevolume becomes big. This causes a problem that the accuracy of estimatedscale factor is reduced. On the other hand, when the code volume ACVdataresulting from the trial compression is less than the threshold value,the amount of information as to the image is not big and this means thequality of the image is not reduced even when the target code volume isset smaller than the original target code volume. Accordingly, in thethird embodiment, when the code volume ACVdata resulting from the trialcompression is less than the threshold value, the target code volume isset smaller than the original target code volume in order to improve theaccuracy of estimating of the scale factor. By this means, it can beachieved to improve the accuracy of estimating of the scale factorwithout reducing of the image quality. Furthermore, the size of file isreduced, accordingly the processing time is reduced and the recordingmedium is utilized more efficiently.

[0121] Also, it may be adopted that the target code volume is increasedwhen the code volume obtained during the trial stage is relatively largeand, consequently, high compression is difficult to achieve. By thismeans, it is possible to avoid any degradation of information.

[0122] In addition, such a change of the target code volume is executedby using the results of the trial compression. Thus, it is possible toexecute both “the change of the target code volume” and “the parameterascertaining” at once through a single trial compression so that thecalculation quantity and the required length of processing time can beminimized.

[0123] (Fourth Embodiment)

[0124] Since the system configuration and the main operation of thefourth embodiment are almost identical to those of the first embodiment(see FIGS. 2, 3 and 4), their explanation is omitted.

[0125] (Explanation of the Preparation)

[0126]FIG. 13 is a flowchart illustrating the preparation procedureexecuted in the fourth embodiment. First, the procedure of thispreparation is explained (in this context, the executor of thepreparation is assumed to be the developer of the program to simplifythe explanation). The developer prepares test images of as many types aspossible within a range representative of the images to be processed.The developer executes DCT on these test images (FIG. 13 S71).

[0127] Next, the developer obtains a number of sets of data (scalefactor SF, code volume ACVdata) by repeating quantization and codingwhile gradually changing the value of the scale factor SF (FIG. 13 S72).

[0128] Next, the developer performs regression analysis on the datacorresponding to the individual test images and determines parameters“a” and “b” that satisfy the relational expression:

log(ACVdata)=a*log(SF)+b  (12). (FIG. 13 S73)

[0129] In FIG. 15, specific test data with respect to the parameters “a”and “b” obtained through this process are plotted. At this time, thedeveloper performs a statistical analysis on the test data with respectto “a” and “b” presented in FIG. 15 to obtain an approximation curve (Sin FIG. 15) that represents the statistical relationship between “a” and“b” (FIG. 13 S74). The developer then stores the approximation curve Sthus obtained in the quantization program in an expression format suchas table data, coefficients in a polynomial, a functional expression orthe like.

[0130] (Explanation of the Quantization Method)

[0131] The following is a detailed explanation of the quantizationmethod.

[0132]FIG. 14 is a flowchart that schematically illustrates the imagecompression program which includes the quantization program executed bythe MPU 12. First, the MPU 12 performs DCT on an input image (FIG. 14S75).

[0133] Next, the MPU 12 quantizes the data that have undergone the DCTby using an initial quantization table (FIG. 14 S76). The MPU 12 thencalculates a code volume ACVdata achieved when the quantized data arecoded (FIG. 14 S77). At this point, the MPU 12 substitutes the codevolume ACV data and the initial scale factor ISF in a relationalexpression:

log(ACVdata)=a*log(ISF)+b  (13),

[0134] to obtain a relational expression that contains undeterminedparameters “a” and “b” (FIG. 14 S78).

[0135] Next, a point of intersection (P in FIG. 15) of the straight lineexpressed in the expression 13 and the approximation curve S isdetermined in the coordinate space whose axes are the undeterminedparameters “a” and “b”. The values of the undetermined parameters “a”and “b” are ascertained based upon the coordinates of the point ofintersection P (FIG. 14 S79). The MPU 12 solves the relationalexpression 12 with the undetermined parameters “a” and “b” ascertainedby substituting the target code volume TCV therein to obtain a targetscale factor NSF (FIG. 14 S80).

[0136] The MPU 12 obtains a quantization table to be employed for thecurrent operation by multiplying a standard quantization table by thetarget scale factor NSF (FIG. 14 S81). Using the quantization table thusobtained, the MPU 12 quantizes the data that have been quantized in stepS75 again. Next, the MPU 12 codes the quantized data (FIG. 14 S83)again.

[0137] By implementing the series of processing described above, imagecompression can be performed with the code volume set close to thetarget code volume TCV.

[0138] (Advantage of the Fourth Embodiment)

[0139] As explained above, in the fourth embodiment, the number ofundetermined parameters in the relational expression is reduced tosubstantially one by using the statistical relationship between theundetermined parameters “a” and “b”. Thus, it is possible to ascertainall the undetermined parameters in the relational expression based uponthe results of a trial compression that is performed at least once.Consequently, it is not necessary to execute a trial compression twiceas required in the method in the prior art so that the calculationquantity and the required length of processing time can be reduced witha high degree of reliability.

[0140] (Supplementary Notes on the Embodiments)

[0141] It is to be noted that while the explanation is given above onthe first through fourth embodiments in which the application isrestricted to quantization for image compression, the quantizationmethod according to the present invention is not limited to applicationfor quantization in image compression. Generally speaking, it may beadopted in all applications of quantization that satisfy the followingrequirements (1) and (2).

[0142] (1) Two undetermined parameters “a” and “b” are contained in arelational expression representing the relationship between the scalefactor and the code volume.

[0143] (2) There is a statistical relationship between the undeterminedparameters “a” and “b”.

[0144] In addition, in those instances of quantization, the format ofthe relational expression is not restricted to that used in theembodiments described above. More specifically, the format of therelational expression should be determined through testing or the likeperformed in the individual instances.

[0145] Furthermore, in the second embodiment, the scale factor and thecode volume are used for the boundary requirements to divide thecoordinate space into the two areas A and B as illustrated in FIG. 10.However, the invention is not limited to this method of area division.Under normal circumstances, areas should be defined as appropriate inconformance to the data distribution in the preparation. Thus, it goeswithout saying that the coordinate space may be divided into three ormore areas. Moreover, the coordinate space may be divided into areas byusing the scale factor only as the boundary requirement or by using thecode volume only as the boundary requirement. It also goes withoutsaying that the shape of the divided areas does not have to berectangular and that they may assume any shape, such as oval or L shape.

[0146] (Example of Variation)

[0147] It is to be noted that while the target scale factor isdetermined through the process of undetermined parameter calculation inthe embodiments explained earlier, it may be obtained through any otherprocess. As explained earlier, the target scale factor can be determinedsince “the code volume during the trial stage” and “the target scalefactor” correspond with each other on a one-to-one basis with a highprobability. In other words, one code volume during the trial stageresults in one target scale factor. Thus, by using the correlationbetween “the code volume during the trial stage” and “the target scalefactor” which is stored in memory in advance, the target scale factorthat corresponds to the code volume during the trial stage may beascertained directly or through interpolation. In such a quantizationmethod, in which the process for calculating the undetermined parameterscan be skipped, the target scale factor can be determined quickly andeasily. Specific procedural steps (1) (6) performed in this method aredescribed below. FIG. 16 is a flowchart illustrating the steps (2)˜(6).

[0148] (1) Test quantization is performed on various types of test dataas a preparation and a conversion table that indicates the correlationbetween “the code volume during the trial stage” and “the target scalefactor” is obtained for each target compression rate.

[0149] (2) An initial quantization table is determined based upon thetarget compression rate, and using this initial quantization table,input data are quantized in a trial (FIG. 16 S101).

[0150] (3) The code volume achieved when the data that have undergonethe trial quantization are coded is ascertained (FIG. 16 S102).

[0151] (4) A conversion table is selected in correspondence to thetarget compression rate (FIG. 16 S103). Using the selected conversiontable, “the code volume during the trial stage” is converted to “thetarget scale factor” (FIG. 16 S104).

[0152] (5) Using the quantization table that corresponds to the targetscale factor, the input data are quantized (FIG. 16 S105).

[0153] (6) Actual coding is performed on the quantized data (FIG. 16S106).

[0154] In this embodiment, an appropriate target scale factor thatcorresponds to the target compression rate can be determined quicklythrough a simple procedure. It is to be noted that the procedure (1)˜(6)described above may be programmed and recorded in a recording medium toenable execution of the procedural steps (1)˜(6) on a computer using therecording medium. In addition, while the correlation is stored in memoryin the form of conversion tables in the procedure (1)˜(6) describedabove, the correlation may be stored in any other form. For instance,the correlation that has been ascertained may be stored as amathematical expression.

[0155] While the explanation is given in reference to the embodimentsabove on an example in which the image compression program that includesthe quantization program and the installation program for installing theimage compression program are provided in a recording medium constitutedof the CD ROM 21, the recording medium may be constituted of any otherform of memory. All types of recording media including magnetic tape,DVD and the like may be employed in the present invention. In addition,these programs may be provided by a data signal embodied in a carrierwave through a transmission medium such as a communication line, atypical example of which is the internet. FIG. 17 illustrates such aconfiguration. A computer 101 executes the quantization programexplained earlier and is similar to the computer 11 in FIG. 2. Thecomputer 101 has a function of connecting with a communication line 102.A computer 103 is a server that provides the data compression programstored therein. The communication line may be a communication line suchas the internet or a communication line for telecomputing or it may be adedicated communication line or the like. The communication line mayincludes a telephone line including a radio telephone such as a cellularphone.

What is claimed is:
 1. A data compression method comprising: aquantization trial step in which input data are quantized using aninitial quantization table set in advance; a coding trial step in whicha code volume achieved when data that have undergone quantization insaid quantization trial step are coded is determined; a relationshipascertaining step in which a scale factor in said initial quantizationtable and the code volume are substituted in “a relational expressionrepresenting a relationship between a code volume and a scale factor”containing two undetermined parameters “a” and “b” and the undeterminedparameters in said relational expression are ascertained based upon “therelational expression after substitution” and “a statisticalrelationship between the undetermined parameters “a” and “b” determinedthrough a previous quantization operation;” a scale factor determiningstep in which a target scale factor corresponding to a target codevolume is determined by using said relational expression having theundetermined parameters ascertained in said relationship ascertainingstep substituted therein; a quantization step in which the input dataare quantized by using a quantization table corresponding to the targetscale factor determined in said scale factor determining step; and acoding step in which data that have undergone quantization in saidquantization step are coded.
 2. A data compression method according toclaim 1, wherein said relationship ascertaining step further includes:(1) an area selection step in which, with a statistical relationshipbetween the two undetermined parameters “a” and “b” ascertained inadvance for each of a plurality of areas achieved by dividing acoordinate space whose axes are a scale factor and a code volume, one ofsaid plurality of areas is selected based upon the scale factor in saidinitial quantization table and the code volume obtained in said codingtrial step; and (2) an individual area relationship ascertaining step inwhich the scale factor in said initial quantization table and the codevolume obtained in said coding trial step are substituted in saidrelational expression and the undetermined parameters in said relationalexpression are ascertained based upon “the relational expression aftersubstitution” and “the statistical relationship in the area selected inthe area selection step.”
 3. A data compression method according toclaim 1, wherein in said scale factor determining step, the target codevolume is changed in correspondence to the code volume determined insaid coding trial step.
 4. A data compression method comprising: aquantization trial step in which input data are quantized using aninitial quantization table set in advance; a coding trial step in whicha code volume ACVdata achieved when data that have undergonequantization in said quantization trial step are coded is determined; acode volume achieved when data that have undergone quantization in saidquantization trial step are coded is determined a relationshipascertaining step in which an undetermined parameter “a” is ascertainedby calculating a={log(ACVdata)−C2 }/{log(ISF)+C1}, using the code volumeACVdata, a scale factor ISF in said initial quantization table andvalues C1 and C2 statistically determined through a previousquantization operation; a scale factor determining step in which atarget scale factor NSF is determined by calculatingNSF=(ACVdata/TCV)^((−1/a))*ISF, using the code volume ACVdata, the scalefactor ISF in said initial quantization table and a target code volumeTCV; a quantization step in which the input data are quantized by usinga quantization table corresponding to the target scale factor NSFdetermined in said scale factor determining step; and a coding step inwhich data that have undergone quantization in said quantization stepare coded.
 5. A data compression method comprising: a quantization trialstep in which input data are quantized using an initial quantizationtable; a coding trial step in which a code volume achieved when datathat have undergone quantization in said quantization trial step arecoded is determined; a scale factor determining step in which a targetscale factor corresponding to the code volume ascertained in said codingtrial step is determined based upon a correlation between “a code volumeachieved when test data are quantized and coded using said initialquantization table” and “a target scale factor to be used inquantization of the test data to achieve a target code volume” that isdetermined and stored in advance; a quantization step in which the inputdata are quantized by using a quantization table corresponding to thetarget scale factor determined in said scale factor determining step;and a coding step in which data that have undergone quantization in saidquantization step are coded.
 6. A recording medium readable for aninformation processing apparatus, that stores a data compression programfor use by the information processing apparatus, the data compressionprogram comprising: a quantization trial step in which input data arequantized using an initial quantization table set in advance; a codingtrial step in which a code volume achieved when data that have undergonequantization in said quantization trial step are coded is determined; arelationship ascertaining step in which a scale factor in said initialquantization table and the code volume are substituted in “a relationalexpression representing a relationship between a code volume and a scalefactor” containing two undetermined parameters “a” and “b” and theundetermined parameters in said relational expression are ascertainedbased upon “the relational expression after substitution” and “astatistical relationship between the undetermined parameters “a” and “b”determined through a previous quantization operation;” a scale factordetermining step in which a target scale factor corresponding to atarget code volume is determined by using said relational expressionhaving the undetermined parameters ascertained in said relationshipascertaining step substituted therein; a quantization step in which theinput data are quantized by using a quantization table corresponding tothe target scale factor determined in said scale factor determiningstep; and a coding step in which data that have undergone quantizationin said quantization step are coded.
 7. A recording medium readable foran information processing apparatus, that stores a data compressionprogram for use by the information processing apparatus, the datacompression program comprising: a quantization trial step in which inputdata are quantized using an initial quantization table; a coding trialstep in which a code volume achieved when data that have undergonequantization in said quantization trial step are coded is determined; ascale factor determining step in which a target scale factorcorresponding to the code volume ascertained in said coding trial stepis determined based upon a correlation between “a code volume achievedwhen test data are quantized and coded using said initial quantizationtable” and “a target scale factor to be used in quantization of the testdata to achieve a target code volume” that is determined and stored inadvance; a quantization step in which the input data are quantized byusing a quantization table corresponding to the target scale factordetermined in said scale factor determining step; and a coding step inwhich data that have undergone quantization in said quantization stepare coded.
 8. A data compression method comprising: a quantization trialstep in which input data are quantized using an initial quantizationtable set in advance; a coding trial step in which a code volumeachieved when data that have undergone quantization in said quantizationtrial step are coded is determined; a scale factor determining step inwhich a target scale factor corresponding to a target code volume isdetermined based upon a scale factor corresponding to said initialquantization table, the code volume determined in said coding trial stepand a statistical relationship between a code volume and a scale factorthat is obtained in advance; a quantization step in which the input dataare quantized by using a quantization table corresponding to the targetscale factor determined in said scale factor determining step; and acoding step in which data that have undergone quantization in saidquantization step are coded.
 9. A recording medium readable for aninformation processing apparatus, that stores a data compression programfor use by the information processing apparatus, the data compressionprogram comprising: a quantization trial step in which input data arequantized using an initial quantization table set in advance; a codingtrial step in which a code volume achieved when data that have undergonequantization in said quantization trial step are coded is determined; ascale factor determining step in which a target scale factorcorresponding to a target code volume is determined based upon a scalefactor corresponding to said initial quantization table, the code volumedetermined in said coding trial step and a statistical relationshipbetween a code volume and a scale factor that is obtained in advance; aquantization step in which the input data are quantized by using aquantization table corresponding to the target scale factor determinedin said scale factor determining step; and a coding step in which datathat have undergone quantization in said quantization step are coded.10. A data signal embodied in a carrier wave comprising a datacompression program for use by an information processing apparatus, thedata compression program comprising: a quantization trial step in whichinput data are quantized using an initial quantization table set inadvance; a coding trial step in which a code volume achieved when datathat have undergone quantization in said quantization trial step arecoded is determined; a scale factor determining step in which a targetscale factor corresponding to a target code volume is determined basedupon a scale factor corresponding to said initial quantization table,the code volume determined in said coding trial step and a statisticalrelationship between a code volume and a scale factor that is obtainedin advance; a quantization step in which the input data are quantized byusing a quantization table corresponding to the target scale factordetermined in said scale factor determining step; and a coding step inwhich data that have undergone quantization in said quantization stepare coded.
 11. A data compression processing apparatus comprising: adata input unit; a quantization trial unit that quantizes input datausing an initial quantization table set in advance; a coding trial unitthat determines a code volume achieved when data that have undergonequantization at said quantization trial unit are coded; a storage unitthat stores a statistical relationship between a code volume and a scalefactor that is obtained in advance; a scale factor determining unit thatdetermines a target scale factor corresponding to a target code volumebased upon a scale factor corresponding to said initial quantizationtable, the code volume determined at said coding trial unit and astatistical relationship between a code volume and a scale factor thatis obtained in advance; a quantization unit that quantizes the inputdata by using a quantization table corresponding to the target scalefactor determined at said scale factor determining unit; and a codingunit that codes data that have undergone quantization at saidquantization unit.
 12. An electronic camera comprising: animage-capturing unit that captures an image of a subject and outputsimage data; a quantization trial unit that quantizes the image datausing an initial quantization table set in advance; a coding trial unitthat determines a code volume achieved when data that have undergonequantization at said quantization trial unit are coded; a storage unitthat stores a statistical relationship between a code volume and a scalefactor that is obtained in advance; a scale factor determining unit thatdetermines a target scale factor corresponding to a target code volumebased upon a scale factor corresponding to said initial quantizationtable, the code volume determined at said coding trial unit and astatistical relationship between a code volume and a scale factor thatis obtained in advance; a quantization unit that quantizes the imagedata using a quantization table corresponding to the target scale factordetermined at said scale factor determining unit; and a coding unit thatcodes data that have undergone quantization at said quantization unit.